
function MyRpgFBUnitCommon( keys )
	if GameRules:GetCustomGameDifficulty() >= 3 then
		keys.ability:ApplyDataDrivenModifier(keys.caster, keys.caster, "modifier_shushan_fb_unit_common_move_speed", nil)
	end
end

function fb_03_boss_jiulongzhaizhaizhu_ability01(keys)
	local caster = keys.caster
	local ability = keys.ability
	ability:StartCooldown(ability:GetCooldown(1))
	caster:RemoveModifierByName("modifier_fb_03_boss_jiulongzhaizhaizhu_ability01")
	
	Timer("fb_03_boss_jiulongzhaizhaizhu_ability01", caster, function ()
		if ability:IsCooldownReady() then
			ability:ApplyDataDrivenModifier(caster, caster, "modifier_fb_03_boss_jiulongzhaizhaizhu_ability01", nil)
			return nil
		end
		return 1
	end)
end

function fb_07_boss_hunmobingyanzhenjun_ability01_precast( keys )
	local caster = keys.caster

	if RollPercentage(50) then
		keys.ability.__is_fire = true
	else
		keys.ability.__is_fire = false
	end

	local p = ParticleManager:CreateParticle("particles/avalon/boss_ready_cast_ability.vpcf", PATTACH_OVERHEAD_FOLLOW, caster)
	ParticleManager:SetParticleControl(p,0,caster:GetOrigin())
	ParticleManager:SetParticleControl(p,1,caster:GetOrigin())
	ParticleManager:SetParticleControl(p,2,Vector(1000,0,0))
	ParticleManager:DestroyParticleSystem(p)
end

function fb_07_boss_hunmobingyanzhenjun_ability01_particle( keys )
	local caster = keys.caster
	
	if keys.ability.__is_fire then
		local path = "particles/avalon/abilities/fb_07_boss_hunmobingyanzhenjun_ability01/fb_07_boss_hunmobingyanzhenjun_ability01_for_fire.vpcf"
		local p = ParticleManager:CreateParticle(path, PATTACH_CUSTOMORIGIN, caster)
		ParticleManager:SetParticleControl(p, 0, caster:GetOrigin())
		ParticleManager:DestroyParticleSystem(p)
	else
		local path = "particles/avalon/abilities/fb_07_boss_hunmobingyanzhenjun_ability01/fb_07_boss_hunmobingyanzhenjun_ability01.vpcf"
		local p = ParticleManager:CreateParticle(path, PATTACH_CUSTOMORIGIN, caster)
		ParticleManager:SetParticleControl(p, 0, caster:GetOrigin())
		ParticleManager:DestroyParticleSystem(p)
	end
end

function fb_07_boss_hunmobingyanzhenjun_ability01(keys)
	local caster = keys.caster

	caster:RemoveModifierByName("modifier_fb_07_boss_hunmobingyanzhenjun_ability01_ice")
	caster:RemoveModifierByName("modifier_fb_07_boss_hunmobingyanzhenjun_ability01_fire")

	if keys.ability.__is_fire then
		keys.ability:ApplyDataDrivenModifier(caster, caster, "modifier_fb_07_boss_hunmobingyanzhenjun_ability01_fire", nil)
	else
		keys.ability:ApplyDataDrivenModifier(caster, caster, "modifier_fb_07_boss_hunmobingyanzhenjun_ability01_ice", nil)
	end
end

function fb_07_boss_hunmobingyanzhenjun_ability01_attack_for_ice( keys )
	local caster = keys.caster
	local target = keys.target
	target:RemoveModifierByName("modifier_fb_07_boss_hunmobingyanzhenjun_ability01_fire_debuff")
	if target:HasModifier("modifier_fb_07_boss_hunmobingyanzhenjun_ability01_ice_debuff") then
		target:RemoveModifierByName("modifier_fb_07_boss_hunmobingyanzhenjun_ability01_ice_debuff")
		keys.ability:ApplyDataDrivenModifier(caster, target, "modifier_fb_07_boss_hunmobingyanzhenjun_ability01_ice_effect", nil)
	end
end

function fb_07_boss_hunmobingyanzhenjun_ability01_attack_for_fire( keys )
	local caster = keys.caster
	local target = keys.target
	target:RemoveModifierByName("modifier_fb_07_boss_hunmobingyanzhenjun_ability01_ice_debuff")
	target:RemoveModifierByName("modifier_fb_07_boss_hunmobingyanzhenjun_ability01_ice_effect")
	if target:HasModifier("modifier_fb_07_boss_hunmobingyanzhenjun_ability01_fire_debuff") then
		target:RemoveModifierByName("modifier_fb_07_boss_hunmobingyanzhenjun_ability01_fire_debuff")
		ApplyDamage({
			attacker = caster,
			victim = target,
			damage = keys.Damage or 13000,
			damage_type = DAMAGE_TYPE_MAGICAL,
		})
	end
end

function fb_06_boss_tulingjvshou_ability01( keys )
	local caster = keys.caster
	local ability = keys.ability

	if ability:IsCooldownReady() then
		ability:StartCooldown(ability:GetCooldown(ability:GetLevel()))
		ability:ApplyDataDrivenModifier(caster, caster, "modifier_fb_06_boss_tulingjvshou_ability01_effect", nil)

		local p = ParticleManager:CreateParticle("particles/avalon/boss_ready_cast_ability.vpcf", PATTACH_OVERHEAD_FOLLOW, caster)
		ParticleManager:SetParticleControl(p,0,caster:GetOrigin())
		ParticleManager:SetParticleControl(p,1,caster:GetOrigin())
		ParticleManager:SetParticleControl(p,2,Vector(ability:GetSpecialValueFor("radius"),0,0))
		ParticleManager:DestroyParticleSystem(p)
	end
end


------------------------------------------------------------------

function FB19BOSS_DiHen_Ability01( keys )
	local caster = keys.caster
	local origin = GetGroundPosition(caster:GetOrigin(), caster)
	local face = caster:GetForwardVector()
	local angle = 15
	local ability = keys.ability
	local index = 1
	local point = origin + face*keys.Radius
	local isReverse = RollPercentage(50)

	if isReverse then index = -1 end

	Timer("FB19BOSS_DiHen_Ability01", caster, function ()
		if isReverse then
			if angle*index <= -360 then
				return nil
			end
		else
			if angle*index >= 360 then
				return nil
			end
		end

		local pos = RotatePosition(origin, QAngle(0,angle*index,0), point)

		ability:ApplyDataDrivenThinker(caster, pos, "modifier_fb_19_boss_dihen_ability01_damage", {duration=1.5})

		if isReverse then
			index = index - 1
		else
			index = index + 1
		end
		return 0.05
	end)
end

function FB19BOSS_DiHen_Ability02_Random( keys )
	local caster = keys.caster
	local entities = keys.target_entities
	local origin = GetGroundPosition(caster:GetOrigin(), caster)

	local pos = nil

	if entities and #entities > 0 then
		local unit = entities[RandomInt(1, #entities)]
		pos = unit:GetOrigin() + RandomVector(RandomFloat(0, 100))
	end

	if pos == nil then
		pos = origin + RandomVector(RandomFloat(100, 1000))
	end

	keys.ability:ApplyDataDrivenThinker(caster, pos, "modifier_fb_19_boss_dihen_ability02_damage", {duration=2.0})

	local radius = 150
	local p = ParticleManager:CreateParticle("particles/avalon/boss_ready_cast_ability_a.vpcf", PATTACH_OVERHEAD_FOLLOW, caster)
	ParticleManager:SetParticleControl(p,0,caster:GetOrigin())
	ParticleManager:SetParticleControl(p,1,pos)
	ParticleManager:SetParticleControl(p,2,Vector(radius,radius,radius))
	ParticleManager:DestroyParticleSystem(p)
	
end

function FB19BOSS_DiHen_Ability02(keys)
	local caster = keys.caster
	local target = keys.target
	local origin = GetGroundPosition(target:GetOrigin(), caster)
	local p = ParticleManager:CreateParticle("particles/units/heroes/hero_invoker/invoker_chaos_meteor_fly.vpcf", PATTACH_CUSTOMORIGIN, target)
	ParticleManager:SetParticleControl(p, 0, origin + Vector(0,0,900))
	ParticleManager:SetParticleControl(p, 1, origin)
	ParticleManager:SetParticleControl(p, 2, Vector(1000,0,0))
	ParticleManager:SetParticleControl(p, 3, origin)
	ParticleManager:DestroyParticleSystem(p)
end

function FB19BOSS_DiHen_Ability04( keys )
	local caster = keys.caster
end


function FB13BOSS_Dizangwang_Ability01( keys )
	local caster = keys.caster
	local ability = keys.ability

	local oldUnit = ability.__unit

	if oldUnit == nil or oldUnit:IsNull() or not oldUnit:IsAlive() then
		local unit = CreateUnitByName("fb_13_boss_dizangwang_diting", caster:GetOrigin(), true, nil, nil, caster:GetTeam())
		unit:SetBaseDamageMax(caster:GetBaseDamageMax()*0.25)
		unit:SetBaseDamageMin(caster:GetBaseDamageMin()*0.25)
		unit:SetBaseMaxHealth(caster:GetMaxHealth()*0.5)
		unit:SetMaxHealth(caster:GetMaxHealth()*0.5)
		unit:SetPhysicalArmorBaseValue(caster:GetPhysicalArmorValue(false))
		unit:SetHealth(unit:GetMaxHealth())
		ability.__unit = oldUnit

		local endTime = GameRules:GetGameTime() + 10
		unit:SetContextThink("FB13BOSS_Dizangwang_Ability01_Think", function ()
			if unit:IsNull() or not unit:IsAlive() then
				return nil
			end

			if GameRules:GetGameTime() >= endTime then
				unit:RemoveSelf()
			end

			return 1
		end, 0)
	end
		
end


------------------------------------------------------------------
-- 雷霆之灵
local leitingzhiling_Ability01_UnitCount = 0
function FB21BOSS_leitingzhiling_Ability01(keys)
	local caster = keys.caster
	local pos = caster:GetAbsOrigin() + RandomVector( RandomFloat( 0, 600 ) )
	local e = ParticleManager:CreateParticle('particles/units/heroes/hero_zuus/zuus_lightning_bolt.vpcf', PATTACH_CUSTOMORIGIN, caster)
	ParticleManager:SetParticleControl(e, 0, pos + Vector(0,0,2000))
	ParticleManager:SetParticleControl(e, 1, pos)
	ParticleManager:DestroyParticleSystem(e)
	caster:EmitSound("FBUnitAbilities.fb_21_boss_leitingzhiling")

	-- 周围没单位就退出
	if leitingzhiling_Ability01_UnitCount <= 0 then
		return
	end

	local teams = DOTA_UNIT_TARGET_TEAM_ENEMY
    local types = DOTA_UNIT_TARGET_BASIC+DOTA_UNIT_TARGET_HERO
    local flags = DOTA_UNIT_TARGET_FLAG_NONE
	local group = FindUnitsInRadius(caster:GetTeam(), pos, nil, 150, teams, types, flags, FIND_ANY_ORDER, false )
	for i,target in ipairs(group) do
		ApplyDamage({
			attacker = caster,
			victim = target,
			damage = keys.Damage,
			damage_type = DAMAGE_TYPE_MAGICAL,
		})
	end
end

function FB21BOSS_leitingzhiling_Ability01_Aura(keys)
	if keys.Entry > 0 then
		leitingzhiling_Ability01_UnitCount = leitingzhiling_Ability01_UnitCount + 1
	else
		leitingzhiling_Ability01_UnitCount = leitingzhiling_Ability01_UnitCount - 1
	end
end

------------------------------------------------------------------
-- 昧火之灵
local meihuozhiling_Ability01_UnitCount = 0
function FB21BOSS_meihuozhiling_Ability01(keys)
	local caster = keys.caster
	local pos = caster:GetAbsOrigin() + RandomVector( RandomFloat( 0, 600 ) )
	local e = ParticleManager:CreateParticle('particles/avalon/abilities/fb_21_boss_meihuozhiling/fb_21_boss_meihuozhiling_ability01.vpcf', PATTACH_CUSTOMORIGIN, caster)
	ParticleManager:SetParticleControl(e, 0, pos)
	-- ParticleManager:SetParticleControl(e, 1, pos)
	ParticleManager:DestroyParticleSystem(e)
	-- caster:EmitSound("FBUnitAbilities.fb_21_boss_meihuozhiling")

	-- 周围没单位就退出
	if meihuozhiling_Ability01_UnitCount <= 0 then
		return
	end

	local teams = DOTA_UNIT_TARGET_TEAM_ENEMY
    local types = DOTA_UNIT_TARGET_BASIC+DOTA_UNIT_TARGET_HERO
    local flags = DOTA_UNIT_TARGET_FLAG_NONE
	local group = FindUnitsInRadius(caster:GetTeam(), pos, nil, 150, teams, types, flags, FIND_ANY_ORDER, false )
	for i,target in ipairs(group) do
		ApplyDamage({
			attacker = caster,
			victim = target,
			damage = keys.Damage,
			damage_type = DAMAGE_TYPE_MAGICAL,
		})
	end
end

function FB21BOSS_meihuozhiling_Ability01_Aura(keys)
	if keys.Entry > 0 then
		meihuozhiling_Ability01_UnitCount = meihuozhiling_Ability01_UnitCount + 1
	else
		meihuozhiling_Ability01_UnitCount = meihuozhiling_Ability01_UnitCount - 1
	end
end


------------------------------------------------------------------
-- 迅风之灵
local xunfengzhiling_Ability01_UnitCount = 0
function FB21BOSS_xunfengzhiling_Ability01(keys)
	local caster = keys.caster
	local pos = caster:GetAbsOrigin() + RandomVector( RandomFloat( 0, 600 ) )
	local e = ParticleManager:CreateParticle('particles/avalon/abilities/fb_21_boss_xunfengzhiling/fb_21_boss_xunfengzhiling_ability01.vpcf', PATTACH_CUSTOMORIGIN, caster)
	ParticleManager:SetParticleControl(e, 0, pos)
	ParticleManager:DestroyParticleSystem(e)
	-- caster:EmitSound("FBUnitAbilities.fb_21_boss_xunfengzhiling")

	-- 周围没单位就退出
	if xunfengzhiling_Ability01_UnitCount <= 0 then
		return
	end

	local teams = DOTA_UNIT_TARGET_TEAM_ENEMY
    local types = DOTA_UNIT_TARGET_BASIC+DOTA_UNIT_TARGET_HERO
    local flags = DOTA_UNIT_TARGET_FLAG_NONE
	local group = FindUnitsInRadius(caster:GetTeam(), pos, nil, 150, teams, types, flags, FIND_ANY_ORDER, false )
	for i,target in ipairs(group) do
		ApplyDamage({
			attacker = caster,
			victim = target,
			damage = keys.Damage,
			damage_type = DAMAGE_TYPE_MAGICAL,
		})
	end
end

function FB21BOSS_xunfengzhiling_Ability01_Aura(keys)
	if keys.Entry > 0 then
		xunfengzhiling_Ability01_UnitCount = xunfengzhiling_Ability01_UnitCount + 1
	else
		xunfengzhiling_Ability01_UnitCount = xunfengzhiling_Ability01_UnitCount - 1
	end
end

------------------------------------------------------------------
-- 泥葬之灵
function FB21BOSS_nizangzhiling_Ability01_Aura( keys )
	local caster = keys.caster
	local target = keys.target
	local modifier = target:FindModifierByName('modifier_fb_21_boss_nizangzhiling_ability01_aura')
	if modifier == nil then
		return
	end
	modifier:SetStackCount(modifier:GetStackCount()+1)

	ApplyDamage({
		attacker = caster,
		victim = target,
		damage = keys.BaseDamage * modifier:GetStackCount(),
		damage_type = DAMAGE_TYPE_MAGICAL,
	})
end


------------------------------------------------------------------
-- 荒天魔龙
function huangtianmolong_damage( caster, target )
	target:AddNewModifier(caster, nil, 'modifier_stunned', {duration=2})
	ApplyDamage({
		attacker = caster,
		victim = target,
		damage = 25000,
		damage_type = DAMAGE_TYPE_MAGICAL,
	})
end

function huangtianmolong_lighting_bolt( caster, origin, radius )
	local e = ParticleManager:CreateParticle('particles/avalon/abilities/fb_20_boss_huangtianmolong/huangtianmolong_lightning_bolt.vpcf', PATTACH_CUSTOMORIGIN, caster)
	ParticleManager:SetParticleControl(e, 0, origin + Vector(0,0,2000))
	ParticleManager:SetParticleControl(e, 1, origin)
	ParticleManager:SetParticleControl(e, 2, origin)
	ParticleManager:DestroyParticleSystem(e)
	caster:SetContextThink("huangtianmolong_lighting_bolt", function()
		caster:EmitSound("FBUnitAbilities.fb_21_boss_leitingzhiling")
	end,0)

	local teams = DOTA_UNIT_TARGET_TEAM_ENEMY
    local types = DOTA_UNIT_TARGET_BASIC+DOTA_UNIT_TARGET_HERO
    local flags = DOTA_UNIT_TARGET_FLAG_NONE
	local group = FindUnitsInRadius(caster:GetTeam(), origin, nil, radius, teams, types, flags, FIND_ANY_ORDER, false )
	for i,target in ipairs(group) do
		huangtianmolong_damage( caster, target )
	end
end

function huangtianmolong_lighting_bolt_pre( caster, origin, radius, duration )
	local e = ParticleManager:CreateParticle('particles/avalon/abilities/fb_20_boss_huangtianmolong/huangtianmolong_ability01.vpcf', PATTACH_CUSTOMORIGIN, caster)
	ParticleManager:SetParticleControl(e, 0, origin)
	ParticleManager:SetParticleControl(e, 1, Vector(radius/2,radius/2,0))
	ParticleManager:SetParticleControl(e, 2, Vector(radius*3,0,0))
	Wait(DoUniqueString("huangtianmolong"), caster, duration, function()
		ParticleManager:DestroyParticle(e, true)
		ParticleManager:ReleaseParticleIndex(e)
	end)
end

function Huangtianmolong_PreAbility01( keys )
	local caster = keys.caster
	local origin = caster:GetAbsOrigin()
	local target = origin + Vector(500,0,0)
	local angle = 360/5
	for i=1,5 do
		local vec = RotatePosition( origin, QAngle(0,angle*i,0), target )
		huangtianmolong_lighting_bolt_pre( caster, vec, 300, 0.5 )
	end
end

function Huangtianmolong_Ability01( keys )
	local caster = keys.caster
	local origin = caster:GetAbsOrigin()
	local target = origin + Vector(500,0,0)
	local angle = 360/5
	for i=1,5 do
		local vec = RotatePosition( origin, QAngle(0,angle*i,0), target )
		huangtianmolong_lighting_bolt( caster, vec, 300 )
	end
end

local Huangtianmolong_Ability02_Pos = {}
function Huangtianmolong_PreAbility02( keys )
	local caster = keys.caster
	local origin = caster:GetAbsOrigin()

	local teams = DOTA_UNIT_TARGET_TEAM_ENEMY
    local types = DOTA_UNIT_TARGET_BASIC+DOTA_UNIT_TARGET_HERO
    local flags = DOTA_UNIT_TARGET_FLAG_NONE
	local group = FindUnitsInRadius(caster:GetTeam(), origin, nil, 1200, teams, types, flags, FIND_ANY_ORDER, false )
	local target = group[RandomInt(1, #group)]
	if target == nil then
		caster:Stop()
	else
		local face = (target:GetAbsOrigin() - origin):Normalized()
		face.z = 0
		for i=1,4 do
			local pos = origin + face * ((i-1) * 600 + 300)
			table.insert(Huangtianmolong_Ability02_Pos, pos)
			huangtianmolong_lighting_bolt_pre( caster, pos, 300, 0.5 )
		end
	end
end

function Huangtianmolong_Ability02( keys )
	local caster = keys.caster
	local count = #Huangtianmolong_Ability02_Pos
	for i=1,count do
		local pos = table.remove(Huangtianmolong_Ability02_Pos, 1)
		Wait(DoUniqueString("huangtianmolong"), caster, (i-1)*0.2, function()
			huangtianmolong_lighting_bolt( caster, pos, 300 )
		end)
	end
end

function Huangtianmolong_PreAbility03( keys )
	local caster = keys.caster
	caster:EmitSound( 'FBUnitAbilities.huangtianmolong_ability03_start' )
	huangtianmolong_lighting_bolt_pre( caster, caster:GetAbsOrigin(), 1000, 0.5 )
end

function Huangtianmolong_Ability03( keys )
	local caster = keys.caster
	local origin = caster:GetAbsOrigin()
	local e = ParticleManager:CreateParticle('particles/avalon/abilities/fb_20_boss_huangtianmolong/huangtianmolong_ability03.vpcf', PATTACH_CUSTOMORIGIN, caster)
	ParticleManager:SetParticleControl(e, 0, origin)
	ParticleManager:DestroyParticleSystem(e)
	caster:EmitSound( 'FBUnitAbilities.huangtianmolong_ability03_fire' )

	local teams = DOTA_UNIT_TARGET_TEAM_ENEMY
    local types = DOTA_UNIT_TARGET_BASIC+DOTA_UNIT_TARGET_HERO
    local flags = DOTA_UNIT_TARGET_FLAG_NONE
	local group = FindUnitsInRadius(caster:GetTeam(), origin, nil, 1000, teams, types, flags, FIND_ANY_ORDER, false )
	for i,target in ipairs(group) do
		huangtianmolong_damage( caster, target )
	end
end

function Huangtianmolong_Ability04( keys )
	local caster = keys.caster
	local origin = caster:GetAbsOrigin()
	local flyPos = origin + Vector(0,0,500)
	caster:StartGestureWithPlaybackRate( ACT_DOTA_CAST_ABILITY_4, 0.5 )

	local e = ParticleManager:CreateParticle('particles/avalon/abilities/fb_20_boss_huangtianmolong/huangtianmolong_ability04_danger.vpcf', PATTACH_CUSTOMORIGIN, caster)
	ParticleManager:SetParticleControl(e, 0, origin)
	ParticleManager:DestroyParticleSystem(e)

	AnimationTimer(DoUniqueString('Huangtianmolong_Ability04'), caster, 1.1, function(factor)
		local pos = LerpVectors( origin, flyPos, factor )
		caster:SetAbsOrigin( pos )

		if factor >= 1.0 then
			caster:StartGestureWithPlaybackRate( ACT_DOTA_CAST_ABILITY_1, 1 )
			caster:EmitSound('FBUnitAbilities.huangtianmolong_ability04')

			local groundPos = origin - Vector(0,0,700)
			AnimationTimer(DoUniqueString('Huangtianmolong_Ability04'), caster, 0.5, function(factor)
				local pos = LerpVectors( flyPos, groundPos, factor )
				caster:SetAbsOrigin( pos )
				if factor >= 1.0 then
					caster:SetAbsOrigin( origin )
					caster:RemoveGesture(ACT_DOTA_CAST_ABILITY_4)
					caster:RemoveGesture(ACT_DOTA_CAST_ABILITY_1)
					caster:RemoveModifierByName('modifier_fb_20_boss_huangtianmolong_ability04')

					
					local e = ParticleManager:CreateParticle('particles/avalon/abilities/fb_20_boss_huangtianmolong/huangtianmolong_ability04.vpcf', PATTACH_CUSTOMORIGIN, caster)
					ParticleManager:SetParticleControl(e, 0, origin)
					ParticleManager:SetParticleControl(e, 1, Vector(1000,450,225))
					ParticleManager:SetParticleControl(e, 3, origin)
					ParticleManager:DestroyParticleSystem(e)


					local teams = DOTA_UNIT_TARGET_TEAM_ENEMY
				    local types = DOTA_UNIT_TARGET_BASIC+DOTA_UNIT_TARGET_HERO
				    local flags = DOTA_UNIT_TARGET_FLAG_NONE
					local group = FindUnitsInRadius(caster:GetTeam(), origin, nil, 1000, teams, types, flags, FIND_ANY_ORDER, false )
					for i,target in ipairs(group) do
						huangtianmolong_damage( caster, target )
					end

				end
			end)
		end
	end)
end


function Huangtianmolong_Ability05( keys )
	local caster = keys.caster
	local target = keys.target
	if target:HasModifier( 'modifier_ability_shushan_evade_effect' ) then
		return
	end
	target:ForceKill(false)
	caster:Heal(caster:GetMaxHealth()*0.2, nil)
end


function Huangtianmolong_Ability06( keys )
	local caster = keys.caster
	local targets = keys.target_entities
	local target = targets[RandomInt(1, #targets)]
	if target ~= nil then
		local pos = target:GetAbsOrigin()
		huangtianmolong_lighting_bolt_pre( caster, pos, 300, 0.5 )
		Wait(DoUniqueString('Huangtianmolong'), caster, 0.5, function()
			huangtianmolong_lighting_bolt( caster, pos, 300 )
		end)
	end
end

function Huangtianmolong_PreAbility06( keys )
	local caster = keys.caster
	local origin = caster:GetAbsOrigin()
	local e = ParticleManager:CreateParticle('particles/avalon/abilities/fb_20_boss_huangtianmolong/huangtianmolong_ability06_danger.vpcf', PATTACH_CUSTOMORIGIN, caster)
	ParticleManager:SetParticleControl(e, 0, origin)
	Wait(DoUniqueString("huangtianmolong"), caster, 6, function()
		ParticleManager:DestroyParticle(e, true)
		ParticleManager:ReleaseParticleIndex(e)
	end)
end